﻿using EOM.TSHotelManagement.Application;
using EOM.TSHotelManagement.Common.Contract;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace EOM.TSHotelManagement.WebApi.Controllers
{
    public class CustomerAccountController : ControllerBase
    {
        private readonly ICustomerAccountService _customerAccountService;

        public CustomerAccountController(ICustomerAccountService customerAccountService)
        {
            _customerAccountService = customerAccountService;
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="readCustomerAccountInputDto"></param>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost]
        public SingleOutputDto<ReadCustomerAccountOutputDto> Login([FromBody] ReadCustomerAccountInputDto readCustomerAccountInputDto)
        {
            return _customerAccountService.Login(readCustomerAccountInputDto);
        }

        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="readCustomerAccountInputDto"></param>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost]
        public SingleOutputDto<ReadCustomerAccountOutputDto> Register([FromBody] ReadCustomerAccountInputDto readCustomerAccountInputDto)
        {
            return _customerAccountService.Register(readCustomerAccountInputDto);
        }
    }
}
